home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / highlight / highlight-W32GUI-2.2-10b-Setup.exe / {app} / src / stylecolour.h < prev    next >
C/C++ Source or Header  |  2004-10-20  |  3KB  |  108 lines

  1. /***************************************************************************
  2.                           stylecolour.h  -  description
  3.                              -------------------
  4.     begin                : Die Nov 5 2002
  5.     copyright            : (C) 2002 by Andre Simon
  6.     email                : andre.simon1@gmx.de
  7.  ***************************************************************************/
  8.  
  9. /***************************************************************************
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  ***************************************************************************/
  17.  
  18. #ifndef STYLECOLOUR_H
  19. #define STYLECOLOUR_H
  20.  
  21. #include <string>
  22. #include <sstream>
  23. #include <fstream>
  24. #include <cmath>
  25. #include <sstream>
  26.  
  27. using namespace std;
  28.  
  29. namespace highlight {
  30.  
  31. /**\brief Stores colours and returns red, green and blue values in different formats
  32. * @author Andre Simon
  33.  */
  34.  
  35. class StyleColour
  36.   {
  37.   public:
  38.     /** Constructor
  39.         \param r_hex Red value in hex notation
  40.         \param g_hex Blue value in hex notation
  41.         \param b_hex Green value in hex notation
  42.     */
  43.     StyleColour(const string & r_hex, const string & g_hex, const string & b_hex);
  44.  
  45.     /** Constructor
  46.         \param styleColourString String with rgb values
  47.     */
  48.     StyleColour(const string & styleColourString);
  49.  
  50.     StyleColour();
  51.     ~StyleColour(){};
  52.  
  53.    /** Sets red, green and blue values
  54.      \param styleColourString String containing colour attributes
  55.    */
  56.    void setRGBValues(const string & styleColourString);
  57.  
  58.     /** Sets red value
  59.         \param r_hex New red value */
  60.     void setRedValue(const string & r_hex);
  61.  
  62.     /** Sets green value
  63.         \param g_hex New green value */
  64.     void setGreenValue(const string & g_hex);
  65.  
  66.     /** Sets blue value
  67.         \param b_hex New blue value */
  68.     void setBlueValue(const string & b_hex);
  69.  
  70.     /** \return Red value in hex format */
  71.     string& getHexRedValue();
  72.     /** \return Green value in hex format */
  73.     string& getHexGreenValue();
  74.     /** \return Blue value in hex format */
  75.     string& getHexBlueValue();
  76.  
  77.     /** \return Red value in latex format */
  78.     string getLatexRedValue();
  79.     /** \return Green value in latex format */
  80.     string getLatexGreenValue();
  81.     /** \return Blue value in latex format */
  82.     string getLatexBlueValue();
  83.  
  84.     /** \return Red value in tex format */
  85.     string getTexRedValue();
  86.     /** \return Green value in tex format */
  87.     string getTexGreenValue();
  88.     /** \return Blue value in tex format */
  89.     string getTexBlueValue();
  90.  
  91.     /** \return Red value in RTF format */
  92.     string getRTFRedValue();
  93.     /** \return Green value in RTF format */
  94.     string getRTFGreenValue();
  95.     /** \return Blue value in RTF format */
  96.     string getRTFBlueValue();
  97.  
  98.   private:
  99.     string r, g, b;
  100.     string int2str(int);
  101.     string float2str(double);
  102.     int hex2dec(const string &hexVal);
  103.   };
  104.  
  105. }
  106.  
  107. #endif
  108.